<!DOCTYPE html>
<html lang="<%= I18n.locale %>">
<head data-hook="modeler_page_head">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><%= modeler_title %></title>
<%= stylesheet_link_tag 'mes/modeler', media: "all" %>
<%= javascript_include_tag 'mes/modeler' %>
<%= csrf_meta_tags %>
<%= javascript_tag do -%>
<%== "var AUTH_TOKEN = #{form_authenticity_token.inspect};" -%>
<% end -%>
<%= yield :head %>
</head>
<body>
<header class="header <%= current_mes_user ? "logged-in" : "logged-out" %>">
  <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <div class="container-fluid">
      <div class="row">
        <div class="navbar-header col-sm-3 col-md-2">
          <%= link_to('Cloud MES', Mes::Modeler.modeler_path, class: 'logo navbar-brand') %>
          <% if current_mes_user -%>
            <span class="navbar-toggle" id="sidebar-toggle">
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
            </span>
          <% end -%>
        </div>

        <% if current_mes_user %>
          <div class="col-sm-9 col-md-10">
            <div class="navbar-right" data-hook="modeler_login_navigation_bar"></div>
          </div>
        <% end %>
      </div>
    </div>
  </nav>
</header>

<div id="wrapper" class="container-fluid <%= 'sidebar-minimized' if cookies['sidebar-minimized'] == 'true' -%>">
  <div class="row">
    <div class="col-sm-3 col-md-2 hidden-xs sidebar" id="main-sidebar" data-hook="modeler_tabs">
      <ul class="nav nav-sidebar">
        <%= sub_menu_pn_model Mes.t(:pn_model), id: 'sidebar-pn-model', icon: 'road' %>
      </ul>
      <ul class="nav nav-sidebar">
        <%= sub_menu_equipment Mes.t(:equipment), id: 'sidebar-equipment', icon: 'print' %>
      </ul>
      <ul class="nav nav-sidebar">
        <%= sub_menu_configure Mes.t(:configure), id: 'sidebar-configure', icon: 'wrench' %>
      </ul>
      <ul class="nav nav-sidebar">
        <%= sub_menu_setting Mes.t(:settings), id: 'sidebar-setting', icon: 'cog' %>
      </ul>
    </div>
    <div class="<%= cookies['sidebar-minimized'] == 'true' ? 'col-sm-12 col-md-12 sidebar-collapsed' : 'col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2' %>" id="main-part">

      <% if content_for?(:page_title) || content_for?(:page_actions) -%>
        <div class="content-header page-header">
          <div class="row">
            <% if content_for?(:page_title) -%>
              <h1 class="col-sm-<%= content_for?(:page_actions) ? '6' : '12' %>"><%= yield :page_title -%></h1>
            <% end -%>

            <% if content_for?(:page_actions) -%>
              <div class="page-actions col-sm-6" data-hook="toolbar">
                <%= yield :page_actions %>
              </div>
            <% end -%>
          </div>
        </div>
      <% end -%>

      <div class="row">
        <%= flash_alert(flash) %>
        <div class="col-sm-12" id="content" data-hook>
          <%= yield %>
        </div>
      </div>
    </div>
  </div>
</div>
<div data-hook="modeler_footer_scripts"></div>
</body>
</html>
